/*
 * Copyright zhoujun 2021 Wicrenet, Inc. All rights reserved.
 */
package com.ruoyi.netty.initailizer;

import com.ruoyi.netty.handler.HttpServerHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;

/**
 * 【】
 *
 * @author zhoujun
 * Created on 2021/11/24 18:09
 */
public class HttpServerInitailizer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        ChannelPipeline pipeline =socketChannel.pipeline();
        //编码解码合二为一
        pipeline.addLast("httpServerCodec",new HttpServerCodec());
        pipeline.addLast("httpServerHandler",new HttpServerHandler());
    }
}
